package com.zaedu.display.receiver;

import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.zaedu.display.MainActivity;

import java.util.List;

import static android.content.Context.ACTIVITY_SERVICE;


/**
 * @项目名称:
 * @作者: zhongfei
 * @创建时间:2019\3\4
 * @描述: 监听开机
 */
public class BootStrapReceiver extends BroadcastReceiver {

    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
            Intent it = new Intent(context, MainActivity.class);
            it.setAction("android.intent.action.MAIN");
            it.addCategory("android.intent.category.LAUNCHER");
            it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(it);

        } else {
            Log.d("==", "BootStrap 非开机自动启动");
        }
         }


}




